var linkflow = require("/utils/linkflow-wechatapp.min.js");
App({
  onLaunch: function () {
    var _this=this; 
    var _openid='';
    wx.getStorage({
      key: 'openid',
      success (res) {
        
        _this.globalData.openid=res.data;},
      fail(res){
        _this.getLogin();} })
      wx.getSystemInfo({
        success: (res) => {
          _this.globalData.screenHeight=res.screenHeight*(750/res.screenWidth);
        }});
  },
  getLogin: function () {
    var _this=this;
    wx.login({
      success (res) {
        console.log(res)
        if (res.code) {
          _this.globalData.loginCode=res.code;
          wx.request({
            url: 'https://elixir.omnimkt.com/elixir07/web/?c=login',
            data: {cd: res.code},
            header: {'content-type': 'application/json' },
            success (res) {
              _this.globalData.openid=res.data.o;
              wx.setStorage({ key:"openid",data: res.data.o });
            }
          });
        } else {
          console.log('登录失败！' + res.errMsg)
        }
      }})
  },
  domainName:'https://elixir.omnimkt.com/elixir07/',
  //domainName:'http://localhost/newp/',
  globalData: {
    openid: '',
    screenHeight:0,
    loginCode:'',
    entryIn:''
  }
})